﻿
/*
    Copyright Multi-Soft co.2009 
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Data.Common;

using Rmlife.Common;
using Rmlife.Model;

namespace Rmlife.Data
{
    /// <summary>
    /// 数据层工具类
    /// </summary>
    public class DataUtils
    {
        /// <summary>
        /// 获得条件样式
        /// </summary>
        /// <param name="style"></param>
        /// <param name="keyword"></param>
        /// <returns></returns>
        public static string GetCoditionStyle(int style, string keyword)
        {
            string ret = string.Empty;

            if (!string.IsNullOrEmpty(keyword))
            {
                switch (style)
                {
                    // 模糊
                    default:
                    case 0:
                        ret = " like '%" + keyword + "%'";
                        break;
                    // 精确
                    case 1:
                        ret = " = '" + keyword + "'";
                        break;
                    // 后模糊
                    case 2:
                        ret = " like '" + keyword + "%'";
                        break;
                    // 前模糊
                    case 3:
                        ret = " like '%" + keyword + "'";
                        break;
                }
            }
            return ret;
        }
        /// <summary>
        /// 将性别名转化为性别值
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static int GetSexValueByName(string name)
        {
            return 0;
        }
        /// <summary>
        /// 将性别值转化为性别名
        /// </summary>
        /// <param name="sex"></param>
        /// <returns></returns>
        public static string GetSexNameByValue(int sex)
        {
            return "";
        }
    }
}
